
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>申请借款</title>
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/Lobibox.min.css"/><!--ajax提示-->
<link rel="stylesheet" href="css/style.css"><!-- 美化 -->
<script src="js/jquery.min.js"></script>
<script src="js/modernizr.js"></script> <!-- Modernizr -->
<script src="js/main.js"></script> <!-- Resource jQuery -->
<script src="js/jquery.cookie.js"></script><!--缓存-->
<script src="js/Lobibox.min.js"></script><!--消息盒子-->
<script src="js/sms.js"></script><!--短信ajax-->
<script src="js/geolocation.min.js"></script>
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>

<script type="text/javascript" src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript" src="https://apps.bdimg.com/libs/jquery.cookie/1.4.1/jquery.cookie.js"></script>
<script type="text/javascript" src="js/wx.js"></script>
</head>

<body>
<div id="load" style="display:none">
  <div class="spinner">
    <div class="rect1"></div>
    <div class="rect2"></div>
    <div class="rect3"></div>
    <div class="rect4"></div>
    <div class="rect5"></div>
  </div>
  <div class="loadtext" style="text-align:center">页面加载中,请稍候...</div>
</div>
<div class="zzsc-container">
  <form class="cd-form floating-labels" action="addApply.do" method="post" enctype="multipart/form-data" onsubmit="return checkForm();">
    <legend><a href="index.html" style="float:right;">返回首页</a>申请借款</legend>
    <p style="font-size:12px;">请填写真实的借款信息,否则将无法通过信贷员审核!</p>
    <div class="error-message">
        <p>您未开启获取位置权限!</p>
    </div>
    
    <div class="icon">
		<label class="cd-label" for="WX"></label> 
		<input type="text" class="user" id="WX" value="" readonly="readonly" /> 
		<input name="wxid" id="wxid" type="hidden" value="" />
	</div>
    
    <div class="icon">
        <label class="cd-label" for="name">您的姓名</label>
        <input class="user" type="text" name="name" id="name" />
    </div>
    <div class="icon">
        <label class="cd-label" for="phonenum">您的手机号码</label>
        <input class="message" type="text" name="phonenum" id="phonenum" />
    </div>
    <div class="icon cod">
        <span><img id="codimg" src="getCode.do" title="验证码,看不清楚？请点击刷新验证码" onClick="this.src='getCode.do?t='+(new Date().getTime());" style="cursor:pointer" ></span>
        <label class="cd-label" for="cod">验证码</label>
        <input class="message" type="text" name="cod" id="cod" />
    </div>
    <div class="icon cod">
        <input type="button" id="btnSendCode" class="btnSendCode" value="免费获取" />
        <label class="cd-label" for="smscod">短信验证码</label>
        <input class="message" type="text" name="smscod" id="smscod" required />
    </div>
    <div class="icon">
        <label class="cd-label" for="tjr">推荐人手机号码(没有请留空)</label>
        <input onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" name="tjr" type="text" class="message" id="tjr" value=""  />
    </div>
    <div class="cd-select icon">
        <select class="message" name="applyType" id="applyType">
            <option value='100'>花呗套现</option>
            <option value='101'>借呗套现</option>
            <option value='102'>信用卡取现</option>
            <option value='103'>京东套现</option>
        </select>
    </div>
    <input type="submit" id="loadan" class="from_button" value="提交申请" />
  </form>
</div>
<iframe id="posthere" name="posthere" style="display:none;"></iframe>
</body>
<script>
//重置警告框隐藏苹果网址
	function GetQueryString(name)
	{
	     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
	     var r = window.location.search.substr(1).match(reg);
	     if(r!=null)return  unescape(r[2]); return null;
	}
	$(function(){
		var type=GetQueryString("type");
		if(type != undefined && type != null){
			$("#applyType").val(type);
		}
	});
	
	
window.alert = function(name){
  var iframe = document.createElement("IFRAME");
  iframe.style.display="none";
  iframe.setAttribute("src", 'data:text/plain,');
  document.documentElement.appendChild(iframe);
  window.frames[0].window.alert(name);
  iframe.parentNode.removeChild(iframe);
};
//加载页面
window.onload=function(){
	//页面加载完成执行
	$("#load").hide();
	$(".zzsc-container").show();
	//获取地理位置
	//var geolocation = new qq.maps.Geolocation();
	var geolocation = new qq.maps.Geolocation("WTMBZ-AICKU-F6JVY-4TZ3Z-NJN5V-UYBMT", "mapadd");
	var options = {timeout: 3000};
	geolocation.getLocation(showPosition, showErr, options);
	function showPosition(position) {//定位
		JSONaddr = JSON.stringify(position.addr, null, 4);//定位街道失败取市级
		if(JSONaddr.replace(/(^\"*)|(\"*$)/g, "").length == 0){
			JSONaddr = JSON.stringify(position.city, null, 4);
		};
		JSONlat = JSON.stringify(position.lat, null, 4);
		JSONlng = JSON.stringify(position.lng, null, 4);
		$("#gps").val(JSONaddr.replace(/(^\"*)|(\"*$)/g, ""));
		$("#gpsadd").val(JSONlat.replace(/(^\"*)|(\"*$)/g, "")+","+JSONlng.replace(/(^\"*)|(\"*$)/g, ""));
		$(".error-message").hide();
	};
};
//定位失败
function showErr() {
	$("#gps").val("您未开启获取位置权限");
	$(".error-message").show();
};
//获取上传图片展示
$("input[type='file']").change(function(e){
	var dataid = $(this).attr("data-id");
	$("li."+dataid).remove();
	var filsrc = window.URL.createObjectURL($(this)[0].files[0]);
	 console.log(e);
	if(filsrc!=null){
	var filimg = "<li class="+dataid+" style='background:url("+filsrc+") center no-repeat;background-size:cover;height: 100px;'></li>";
	$(this).parent().siblings(".img").append(filimg);
	}
});
//逾期天数显示隐藏
$("#sljl").change(function(){
	var itemi = $(this).val();
	if(itemi=='有'){
		$("#tiansdiv").show();
		//$("#tians").attr("required",true);
	}else{
		$("#tiansdiv").hide();
		//$("#tians").removeAttr("required");
	}
});
//隐藏遮罩层
function loadi(){
	 $("#load").hide();
};
//表单验证
function checkForm(){
	if($("#name").val()==""){
		alert("名字未填写");
		$("#name").focus();
		return false; 
	};
	
	if($("#QQ").val()==""){
		alert("QQ号码未填写");
		$("#QQ").focus();
		return false; 
	};
	
	if($("#wx").val()==""){
		alert("微信号未填写");
		$("#wx").focus();
		return false; 
	};
	
	if($("#phonenum").val()==""){
		alert("手机号码未填写");
		$("#phonenum").focus();
		return false; 
	};
	
	if (flag = true){
		$(".loadtext").html('提交上传验证中,速度与您的网速有关!请勿关闭耐心等待!');
		$("#load").show();
	};
	return true;
}
</script>
</html>